<?php
	
	function deldir($dir) {  
	    //先删除目录下的文件：  
	    $dh = opendir($dir);  
	    while ($file = readdir($dh)) {  
	        if($file != "." && $file!="..") {  
	        $fullpath = $dir."/".$file;  
	        if(!is_dir($fullpath)) {  
	            unlink($fullpath);  
	        } else {  
	            deldir($fullpath);  
	        }  
	        }  
	    }  
	    closedir($dh);  
	       
	    //删除当前文件夹：  
	    if(rmdir($dir)) {  
	        return true;  
	    } else {  
	        return false;  
	    }  
	}
	$path = $_GET['url'];
	//打开文件    
    $file = fopen ( $path, "r" );    
    //输入文件标签     
    Header ( "Content-type: application/octet-stream" );    
    Header ( "Accept-Ranges: bytes" );    
    Header ( "Accept-Length: " . filesize ($path ) );    
    Header ( "Content-Disposition: attachment; filename=" . basename($path) );    
    //输出文件内容     
    //读取文件内容并直接输出到浏览器    
    echo fread ( $file, filesize ( $path ) );    
    fclose ( $file );
	deldir($_GET['path']);
    exit ();    
?>